{$CLEO .s}
{$INCLUDE_ONCE ../cleo_tester.inc}

script_name '2705'
test("2705 (pick_random_int)", tests)
terminate_this_custom_script


function tests
    it("should pick single random int", test1)
    it("should pick random ints", test2)
    return
    
    function test1
        int value = pick_random_int {values} 42
        assert_eq(value, 42)
    end
    
    function test2
        int aCount = 0
        int bCount = 0
        int cCount = 0
        int dCount = 0
                
        int i
        for i = 1 to 300
            int value = pick_random_int {values} -50 100 150
            
            switch value
                case -50
                    aCount += 1
                    
                case 100
                    bCount += 1
                    
                case 150
                    cCount += 1
                    
                default
                    dCount += 1
            end
        end
        
        assert_range(aCount, 80, 120)
        assert_range(bCount, 80, 120)
        assert_range(cCount, 80, 120)
        assert_eq(dCount, 0)
    end
end
